home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 8
/
Night Owl CD-ROM (NOPV8) (Night Owl Publisher) (1993).ISO
/
047a
/
probots.arj
/
CHASER.PR
< prev
next >
Wrap
Text File
|
1988-11-05
|
2KB
|
75 lines
PROCEDURE CHASER;
{
Based on a C-Robot by Kazuhiro Yabe
}
VAR
save_dmg : Integer;
cur_dmg : Integer;
speed : Integer;
dir : Integer;
Range : Integer;
degree : Integer;
PROCEDURE chkdmg;
BEGIN
cur_dmg := damage;
IF (cur_dmg <> save_dmg) THEN
BEGIN
save_dmg := cur_dmg;
speed := 50; {maximum speed that robot can still turn}
dir := Random(359);
END;
END; {chkdmg}
PROCEDURE walking;
BEGIN
speed := 50; {maximum speed that robot can still turn}
IF (loc_x < 200) THEN dir := 0
ELSE IF (loc_x > 800) THEN dir := 180
ELSE IF (loc_y < 200) THEN dir := 90
ELSE IF (loc_y > 800) THEN dir := 270;
drive(dir, speed);
END; {walking}
PROCEDURE shoot;
VAR return : Boolean;
BEGIN
return := False;
REPEAT
REPEAT
Range := scan(degree, 10);
IF (Range > 0) THEN
BEGIN
cannon(degree, Range); {while he's there, shoot at him. }
drive(degree, 100); {charge foe at top speed!}
return := True;
END;
UNTIL Range = 0;
IF (degree >= 360)
THEN degree := 0
ELSE degree := degree+20;
walking;
UNTIL return;
END; {shoot}
BEGIN {Chaser Main}
speed := 50; {maximum speed that robot can still turn}
dir := 0;
degree := 0;
save_dmg := damage;
REPEAT { Until Dead or Winner }
shoot;
chkdmg;
walking; { move at max speed that can still turn }
UNTIL Dead OR Winner;
END; { end of Chaser main }